package com.baizhi.service.impl;

import com.baizhi.entity.Order;
import com.baizhi.mapper.OrderMapper;
import com.baizhi.service.OrderService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class OrderServiceImpl implements OrderService {
    @Autowired
    private OrderMapper mapper;
    @Override
    public PageInfo<Order> showOrderPage(Integer pageNum,Integer pageSize) {
        return new PageInfo<>(mapper.selectAllOrder(pageNum,pageSize));
    }

    @Override
    public Order selectById(Integer id) {
        return mapper.selectOrder(id);
    }

    @Override
    public void addOrder(Order order) {
        mapper.addOrder(order);
    }

    @Override
    public Order showOrderById(Integer id) {
        return mapper.select(id);
    }

    @Override
    public void updateOrder(Order order) {
        mapper.updateOrder(order);
    }
}
